package com.example.hotel_lxy.ui.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.example.hotel_lxy.R;
import com.example.hotel_lxy.application.ARouterPath;
import com.ysxsoft.common_base.base.BaseActivity;
import com.ysxsoft.common_base.base.RBaseAdapter;
import com.ysxsoft.common_base.base.RViewHolder;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 预点菜单
 */
@Route(path = "/main/PredestinationActivity")
public class PredestinationActivity extends BaseActivity {

    @BindView(R.id.back)
    ImageView back;
    @BindView(R.id.rv_hot_food)
    RecyclerView rvHotFood;
    @BindView(R.id.rv_cool_food)
    RecyclerView rvCoolFood;
    @BindView(R.id.rv_staple_food)
    RecyclerView rvStapleFood;
    @BindView(R.id.rv_sweet_food)
    RecyclerView rvSweetFood;
    RBaseAdapter<String> rBaseAdapter;
    List<String> mlist=new ArrayList<>();
    public static void start() {
        ARouter.getInstance().build(ARouterPath.getPredestinationActivity())
                .navigation();
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_predestination;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);

    }

    //甜品
    private void showDateSweetList() {
        rvSweetFood.setLayoutManager(new LinearLayoutManager(this));
        rBaseAdapter=new RBaseAdapter<String>(this,R.layout.item_predestination_activity,mlist) {
            @Override
            protected void fillItem(RViewHolder holder, String item, int position) {

            }

            @Override
            protected int getViewType(String item, int position) {
                return 0;
            }
        };
        rvSweetFood.setAdapter(rBaseAdapter);
    }
    //主食
    private void showDateStapleList() {
        rvStapleFood.setLayoutManager(new LinearLayoutManager(this));
        rBaseAdapter=new RBaseAdapter<String>(this,R.layout.item_predestination_activity,mlist) {
            @Override
            protected void fillItem(RViewHolder holder, String item, int position) {

            }

            @Override
            protected int getViewType(String item, int position) {
                return 0;
            }
        };
        rvStapleFood.setAdapter(rBaseAdapter);
    }
    //凉菜
    private void showDateCoolList() {
        rvCoolFood.setLayoutManager(new LinearLayoutManager(this));
        rBaseAdapter=new RBaseAdapter<String>(this,R.layout.item_predestination_activity,mlist) {
            @Override
            protected void fillItem(RViewHolder holder, String item, int position) {

            }

            @Override
            protected int getViewType(String item, int position) {
                return 0;
            }
        };
        rvCoolFood.setAdapter(rBaseAdapter);
    }
    //热菜
    private void showDateHotList() {
        rvHotFood.setLayoutManager(new LinearLayoutManager(this));
        rBaseAdapter=new RBaseAdapter<String>(this,R.layout.item_predestination_activity,mlist) {
            @Override
            protected void fillItem(RViewHolder holder, String item, int position) {

            }

            @Override
            protected int getViewType(String item, int position) {
                return 0;
            }
        };
        rvHotFood.setAdapter(rBaseAdapter);
    }

    @Override
    public void doWork() {
        super.doWork();
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        for (int i = 0; i <5 ; i++) {
            mlist.add("");
        }
        showDateHotList();
        showDateCoolList();
        showDateStapleList();
        showDateSweetList();
    }
}